﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="ContractTemplate.aspx.cs" Inherits="TravelSite.Admin.ContractTemplate" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            if ($("#hdEmailExists").val() == "1")
            {
                $('#hlEmailTemplate').hide();
                $('#lbSaveEmailTemplate').hide();
                $('#fuEmailTemplate').hide();
            }
            else
            {
                $('#hlEmailTemplate').show();
                <%=this.ConditionalJS%>;
            }

            <%=this.JsCodeToRunOnReady%>;
        });
        
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="page_header">
        <h2><img src="<%=ResolveClientUrl("~") %>images/design/template_tt_icon.png" alt="" title=""/> Templates</h2>
    </div>

    <div class="page_container">
        <asp:UpdatePanel ID="upMain" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:HiddenField runat="server" ID="hdEmailExists" ClientIDMode="Static" Value="0" />
            <div class="row">
            <asp:Repeater runat="server" ID="rptFiles" OnItemDataBound="rptFiles_ItemDataBound" onitemcommand="rptFiles_ItemCommand" >
                <ItemTemplate>

                <div class="col-lg-6">
                    <div class="templates_blocks">
                        <asp:HyperLink ID="hlLink" runat="server" Target="_blank" class="template_file">
                            <asp:Image ID="imgIsEmail" runat="server" />
                            <span><%#Eval("FileName")%></span>
                        </asp:HyperLink>
                        <asp:ImageButton ID="btnDeleteFile" runat="server" CommandName="DeleteFile" Text="Delete" ImageUrl="~/Images/delete.png" />
                    </div>
                </div>
                                            
                </ItemTemplate>
            </asp:Repeater>
            </div>
        </ContentTemplate>
        <Triggers>
        </Triggers>
        </asp:UpdatePanel>
        
        <div class="row">
            <div class="col-lg-6">
                <div class="templates_blocks">
                    
                    <asp:Button ID="btnSaveContractTemplate" ClientIDMode="Static"
                        Text="SaveContractTemplate" runat="server" onclick="btnSaveContractTemplate_Click" style="display:none;" />
                    <asp:FileUpload runat="server" ID="fuContractTemplate" ClientIDMode="Static" Width="100%"/>
                    <% if (!IsIE()) 
                    { %>
                    <a class="template_file" href='javascript:void(0)' onclick="$('#fuContractTemplate').click()">
                        <img src="<%=ResolveClientUrl("~") %>images/design/upload_icon.png" alt="" title="User Management"/>
                        <span>Upload New Contract Template</span>
                    </a>
                    <% } else { %>
                     <asp:LinkButton runat="server" ID="lbSaveContractTemplate" class="template_file" onclick="btnSaveContractTemplate_Click">
                        <img src="<%=ResolveClientUrl("~") %>images/design/upload_icon.png" alt="" title="User Management"/>
                        <span>Upload New Contract Template</span>
                     </asp:LinkButton>   
                    <% } %>
                </div>
            </div>

            <div class="col-lg-6">
                <div class="templates_blocks">
                    <asp:Button ID="btnSaveEmailTemplate" ClientIDMode="Static"
                        Text="SaveEmailTemplate" runat="server" onclick="btnSaveEmailTemplate_Click" style="display:none;" />
                    <asp:FileUpload runat="server" ID="fuEmailTemplate" ClientIDMode="Static" Width="100%"/>
                    <% if (!IsIE()) 
                    { %>
                    <a class="template_file" runat="server" id="hlEmailTemplate" clientidmode="static" href='javascript:void(0)' onclick="$('#fuEmailTemplate').click()">
                        <img src="<%=ResolveClientUrl("~") %>images/design/upload_icon.png" alt="" title="User Management"/>
                        <span>Upload New Email Template</span>
                    </a>
                    <% } else { %>
                    <asp:LinkButton runat="server" ID="lbSaveEmailTemplate" class="template_file" onclick="btnSaveEmailTemplate_Click" ClientIDMode="Static">
                        <img src="<%=ResolveClientUrl("~") %>images/design/upload_icon.png" alt="" title="User Management"/>
                        <span>Upload New Email Template</span>
                     </asp:LinkButton>   
                    <% } %>
                </div>
            </div>
                    
        </div>

    </div>
</asp:Content>
